/**********************************************************************
    LINKER command file for EECS 452 C5510DSK memory map.
    Small memory model --- Version 1.0  25Jul2003 KM
    Added large pages  --- Version 1.01 18Nov2003 KM
    
    Appears to work ok for large memory model as well.
    Linker represents addresses and allocations using 8-bit bytes!!!!!!
    
**********************************************************************/

-stack    0x2000 /* Primary stack size   .. fills one 8KB block */
-sysstack 0x1000 /* Secondary stack size .. fills one half 8KB block */
-heap     0x2000 /* Heap area size       .. fills one 8KB block */

-c               /* Use C linking conventions: auto-init vars at runtime */
-u _Reset        /* Force load of reset interrupt handler */

MEMORY 
{
  PAGE 0:      /* ---- Unified Program/Data Address Space ---- */
    MMR_RSVD      : origin = 0x000000, length = 0x0000BF /* 192 bytes MMR reserved */
    VECT   (RWIX) : origin = 0x000100, length = 0x000100 /* 256 byte interrupt vector */
    DARAM  (RWIX) : origin = 0x000200, length = 0x00FD00 /* almost 64KB of DARAM */
    SARAM0 (RWIX) : origin = 0x010000, length = 0x010000 /*   64KB of SARAM */
    SARAM1 (RWIX) : origin = 0x020000, length = 0x020000 /*  128KB of SARAM */
    SARAM2 (RWIX) : origin = 0x040000, length = 0x010000 /*   64KB of SARAM */
    /* SDRAM has 0xB0000 37776 KB of SDRAM .. notall  allocated here */
    SDRAM0 (RWIX) : origin = 0x050000, length = 0x010000 /*   64KB of SDRAM */
    SDRAM1 (RWIX) : origin = 0x060000, length = 0x020000 /*  128KB of SDRAM */
    SDRAM2 (RWIX) : origin = 0x080000, length = 0x020000 /*  128KB of SDRAM */
    SDRAM3 (RWIX) : origin = 0x0A0000, length = 0x020000 /*  128KB of SDRAM */ 
    SDRAM4 (RWIX) : origin = 0x0C0000, length = 0x020000 /*  128KB of SDRAM */  
    SDRAM5 (RWIX) : origin = 0x0E0000, length = 0x020000 /*  128KB of SDRAM */
    SDRAM6 (RWIX) : origin = 0x100000, length = 0x020000 /*  128KB of SDRAM */
    SDRAM7 (RWIX) : origin = 0x120000, length = 0x020000 /*  128KB of SDRAM */
    SDRAM8 (RWIX) : origin = 0x140000, length = 0x020000 /*  128KB of SDRAM */ 
    SDRAM9 (RWIX) : origin = 0x160000, length = 0x020000 /*  128KB of SDRAM */   
    SDRAM10(RWIX) : origin = 0x180000, length = 0x020000 /*  128KB of SDRAM */ 
    SDRAM11(RWIX) : origin = 0x1A0000, length = 0x020000 /*  128KB of SDRAM */      
    FLASH         : origin = 0x400000, length = 0x80000
    VECS (RIX)    : origin = 0xffff00, length = 0x000100 /* 256-byte int vector*/
}

SECTIONS
{
    .text       > SARAM0 PAGE 0 /* Code */

/* These sections must be on same physical memory page */
/* when small memory model is used */

    .data       > DARAM  PAGE 0 /* Initialized vars */
    .bss        > DARAM  PAGE 0 /* Global & static vars */
    .const      > DARAM  PAGE 0 /* Constant data */
    .sysmem     > DARAM  PAGE 0 /* Dynamic memory (malloc) */
    .stack      > DARAM  PAGE 0  ALIGN = 0x2000 /* Primary system stack */
    .sysstack   > DARAM  PAGE 0  ALIGN = 0x2000 /* Secondary system stack */
    .cio        > SARAM0 PAGE 0 /* C I/O buffers */

/* These sections may be on any physical memory page */
/* when small memory model is used */

    .switch     > SARAM0 PAGE 0 /* Switch statement tables */
    .cinit      > SARAM0 PAGE 0 /* Auto-initialization tables */
    .pinit      > SARAM0 PAGE 0 /* Initialization fn tables */

     vectors    > VECT   PAGE 0 /* Interrupt vectors */
     
/* Allocate pages in SARAM for when using large memory model */     
     
     SARAMA     > SARAM0  PAGE 0 
     SARAMB     > SARAM1  PAGE 0 
     SARAMC     > SARAM2  PAGE 0 
     
/* Allocate pages in SDRAM for when using large memory model */     
     
     SDRAMA     > SDRAM0  PAGE 0   /* 32K word page */
     SDRAMB     > SDRAM1  PAGE 0   /* 64K word page */
     SDRAMC     > SDRAM2  PAGE 0   /* 64K word page */
     SDRAMD     > SDRAM3  PAGE 0   /* 64K word page */
     SDRAME     > SDRAM4  PAGE 0   /* 64K word page */
     SDRAMF     > SDRAM5  PAGE 0   /* 64K word page */
     SDRAMG     > SDRAM6  PAGE 0   /* 64K word page */
     SDRAMH     > SDRAM7  PAGE 0   /* 64K word page */
     SDRAMI     > SDRAM8  PAGE 0   /* 64K word page */
     SDRAMJ     > SDRAM9  PAGE 0   /* 64K word page */
     SDRAMK     > SDRAM10 PAGE 0   /* 64K word page */
     SDRAML     > SDRAM11 PAGE 0   /* 64K word page */ 
}